function foo() {
    console.log('i am foo')
    return 'foo'
}

const bar = function (name) {
    console.log(`i am bar ${name}`)
    return "bar"
}

const baz = (name) => {
    console.log('i am baz ' + name)
    return 'baz'
}
//如果有一个参数可以省略括号
const baz1 = name => {
    console.log('i am baz ' + name)
    return 'baz'
}

const baz2 = (name, age) => {
    console.log('i am baz ' + name + age)
    return 'baz'
}

const baz3 = () => 'baz'
const baz4 = () => {
    return 'baz'
}

var stus = [{
        stuNum: 1101,
        name: '曹操',
        score: 95
    },
    {
        stuNum: 1102,
        name: '吕布',
        score: 50
    },
    {
        stuNum: 1103,
        name: '貂蝉',
        score: 65
    },
    {
        stuNum: 1104,
        name: '赵云',
        score: 70
    },
    {
        stuNum: 1105,
        name: '赵信',
        score: 85
    }
];

const htmlArr = stus.map(item => `<tr><td>${item.stuNum}</td><td>${item.name}</td><td>${item.score}</td></tr>`)

/*
区别：
1.写法
2.箭头函数没有this
*/
const stu = {
    name:"lily",
    say:function(){
        console.log(this)
        function foo1(){
            //调用自己的this
            console.log(this)
        }
        foo1()
    },
    hello:() => {
        console.log(this)
    },
    hi:function(){
        //箭头函数调用的是这里的this
        const bar = () => {
            console.log(this)
        }
        bar()
    }
}
stu.say()
stu.hello()
stu.hi()